package com.yc.sole.erp.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yc.sole.erp.enums.StockOperationType;
import com.yc.sole.framework.mybatis.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.Data;

/**
 * @author yizuomin
 * @date 2024/1/26 21:20
 **/
@Data
@Entity
@Table(name = "erp_stock_log")
@TableName(value = "erp_stock_log", autoResultMap = true)
public class StockLog extends BaseEntity {

    /**
     * id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 产品id
     */
    @Column(columnDefinition = "BIGINT NOT NULL COMMENT '产品id'")
    private Long productId;
    /**
     * 产品名称
     */
    @Column(columnDefinition = "VARCHAR(50) NOT NULL COMMENT '产品名称'")
    private String productName;
    /**
     * 类型
     */
    @Column(columnDefinition = "TINYINT NOT NULL COMMENT '类型'")
    private StockOperationType type;
    /**
     * 变动数量
     */
    @Column(columnDefinition = "INT UNSIGNED NOT NULL COMMENT '变动数量'")
    private Integer quantity;
    /**
     * 变更前库存
     */
    @Column(columnDefinition = "INT UNSIGNED NOT NULL COMMENT '变更前库存'")
    private Integer beforeStock;
    /**
     * 变更后库存
     */
    @Column(columnDefinition = "INT UNSIGNED NOT NULL COMMENT '变更后库存'")
    private Integer afterStock;
    /**
     * 变动单位
     */
    @Column(columnDefinition = "VARCHAR(10) NOT NULL COMMENT '变动单位'")
    private String unit;
    /**
     * 备注
     */
    @Column(columnDefinition = "VARCHAR(255) COMMENT '备注'")
    private String remark;
}
